import { Injectable,Inject } from '@angular/core';
import {HttpClient} from "@angular/common/http";
import {Observable} from "rxjs";
import {Quote} from "../domain/quote.model"
import {debug} from "../utils/debug.util";
import {map} from "rxjs/operators";
@Injectable({
  providedIn: 'root'
})
export class QuoteService {

  constructor(private http:HttpClient,@Inject('BASE_CONFIG') private config) { }
  getQuote():Observable<Quote>{
     return this.http.get(`${this.config.uri}/quote/${Math.floor(Math.random()*4+1)}`).pipe(
         map(res=>res as Quote)
       )
  }
}
